<?php
declare (strict_types=1);

namespace app\common\model;

class Area extends Base
{
    protected $name = 'area';


    public static function getArea($parent_code = 100000, $level = 1)
    {
        
        if($level==1){
            $filed = 'province as title';
        }else if($level==2){
            $filed = 'city as title';
        }else{
            $filed = 'district as title';
        }
        
        //print_r($filed);die;
        return parent::where(['parent_code' => $parent_code, 'level' => $level])
            ->field('code,' . $filed)->select();
    }
}
